package com.px.lovepath.ui.home;

import java.util.Date;

import android.R.integer;
import android.text.format.DateUtils;
import android.util.Log;

import com.px.lovepath.domain.config.ConfigInfo;
import com.px.lovepath.utils.DateUtil;
import com.px.lovepath.utils.LLog;

public class CallRecord extends LoveMessage {

	private final long mDuration;
	
	public CallRecord(Date date, long duration, int type) {
		super(date, type == 0 ? Path.TOIT : Path.TOME);
		mDuration = duration;
		StringBuffer sb = new StringBuffer();
		if (getPath() == Path.TOIT) {
			sb.append(ConfigInfo.get().getUserName());
		} else {
			sb.append(ConfigInfo.get().getTaName());			
		}
		sb.append(" ").append("在").append(" ");
		sb.append(DateUtil.getDateString(mDate));
		sb.append(" ").append("给").append(" ");
		if (getPath() == Path.TOIT) {
			sb.append(ConfigInfo.get().getTaName());			
		} else {
			sb.append(ConfigInfo.get().getUserName());
		}
		sb.append(" ").append("打了电话，通话时长");
		sb.append(DateUtils.formatElapsedTime(mDuration));
		sb.append("!");
		mMessage = sb.toString();
		LLog.p("", mMessage);
	}
	public CallRecord(Date date, Path type, String info) {
		super(date, type);
		mDuration = 0;
	}
	
	
	@Override
	public String getMessage() {
		return mMessage;
	}
	@Override
	public String getInfo() {
		return null;
	}

}
